home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / ISALPHA.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  750 b   |  53 lines

  1. #include <stdio.h>
  2. #include <ctype.h>
  3. main()
  4. {
  5.     int ch, count,
  6.         mark = 0xdb;                    /* to mark characters */
  7.  
  8.     /* Go over entire ASCII table and display the
  9.      * alphabetic ones.
  10.      */
  11.  
  12.      printf(
  13.      "Letters are marked with a %c\n", mark);
  14.  
  15.      printf(" ");
  16.      for(count = 0, ch = 0; ch <= 0x07f; ch++)
  17.      {
  18.         printf("%#02x", ch);
  19.         if(ch < 0xf)
  20.         printf(" ");
  21.  
  22.  
  23.      /* Print character- if printable */
  24.         if(isprint(ch))
  25.         {
  26.             printf("  %c", ch);
  27.  
  28.         }
  29.         else
  30.         {
  31.         printf("   ");
  32.         }
  33.  
  34.      /* Perform a test and put a mark if test succeeds */
  35.  
  36.         if(isalpha(ch) != 0)
  37.         {
  38.             printf("%c ", mark);
  39.         }
  40.         else
  41.         {
  42.             printf("  ", ch);
  43.         }
  44.         count++;
  45.         if(count == 8)
  46.         {
  47.             printf(" \n");
  48.             count = 0;
  49.         }
  50.      }
  51. }
  52.  
  53.